home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-gst0.10 / examples / mixer.py < prev    next >
Encoding:
Text File  |  2009-02-21  |  817 b   |  32 lines

  1. # -*- Mode: Python -*-
  2. # vi:si:et:sw=4:sts=4:ts=4
  3.  
  4. import sys
  5.  
  6. import gst
  7. import gst.interfaces
  8.  
  9. pipeline = "alsasrc"
  10. if sys.argv[1:]:
  11.     pipeline = " ".join(sys.argv[1:])
  12. a = gst.element_factory_make(pipeline)
  13. print dir(a)
  14.  
  15. res = a.set_state(gst.STATE_PAUSED)
  16. if res != gst.STATE_CHANGE_SUCCESS:
  17.     print "Could not set pipeline %s to PAUSED" % pipeline
  18.  
  19. print "Inputs:"
  20. for t in a.list_tracks():
  21.     if t.flags & gst.interfaces.MIXER_TRACK_INPUT:
  22.         sys.stdout.write(t.label)
  23.     sys.stdout.write(': %d - %d' % (t.min_volume, t.max_volume))
  24.     volumes = a.get_volume(t)
  25.     sys.stdout.write(': %r' % (volumes, ))
  26.     if t.props.num_channels > 0:
  27.         a.set_volume(t, volumes=volumes)
  28.     if t.flags & gst.interfaces.MIXER_TRACK_RECORD:
  29.         sys.stdout.write(' (selected)')
  30.     sys.stdout.write('\n')
  31.  
  32.